/**
 * 全局axios拦截器
 */

import axios from 'axios';

axios.defaults.headers.get["Content-Type"] = 'application/x-www-form-urlencoded';

axios.interceptors.request.use(config =>{
    const token = localStorage.getItem('userToken');
    if(token){
        config.headers.accessToken = token;
    }
    return config;
},
error =>{
    return Promise.reject(error);
});

axios.interceptors.response.use(response =>{
    return response;
},
error => {
    return Promise.reject(error);
});

export default axios;